package com.kingyun.gpsinspection.purificationservice.services.som.innerservice.impl;

import com.kingyun.gpsinspection.purificationservice.dao.mapper.som.FacadeDeviceOperateInfoMapper;
import com.kingyun.gpsinspection.purificationservice.dao.mapper.tdm.TdmHazardMapper;
import com.kingyun.gpsinspection.purificationservice.facade.model.som.FacadeDeviceOperateInfo;
import com.kingyun.gpsinspection.purificationservice.facade.model.tdm.Hazard;
import com.kingyun.gpsinspection.purificationservice.facade.service.som.SomHazardService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 危险因素service实现类
 * Created by liuyj on 2017/1/12.
 */
public class SomHazardServiceImpl implements SomHazardService {
    @Autowired
    private TdmHazardMapper tdmHazardMapper;
    @Autowired
    private FacadeDeviceOperateInfoMapper facadeDeviceOperateInfoMapper;

    /**
     * 上报危险因素
     *
     * @param hazard
     * @return
     */
    @Override
    public int addHazard(Hazard hazard) {
        return tdmHazardMapper.insert(hazard);
    }

    /**
     * 受控列表
     *
     * @param orgId
     * @param limit
     * @param offset
     * @return
     */
    @Override
    public List<FacadeDeviceOperateInfo> queryListByOrgId(String orgId, int limit, int offset) {
        Map map = new HashMap<>();
        map.put("orgId", orgId);
        map.put("limit", limit);
        map.put("offset", offset);
        return facadeDeviceOperateInfoMapper.queryListByOrgId(map);
    }
}
